<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@  taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="none">
    <meta name="author" content="Geofarry_Liang">
    <title>QueryTools System</title>
    <!-- Bootstrap core CSS -->
    <link href="/QueryTools/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/QueryTools/css/signin.css" rel="stylesheet">
    <style type="text/css">
    body {
	  padding-top: 70px;
	}
    </style>
    <script type="text/javascript">
       /*
		弹出框,需要滚动条显示
		*/
		function openWindow(url,h,w){
			var Y=(window.screen.availHeight-h)/2;
		    var X=(window.screen.availWidth-w)/2;
		    var dm = "Height="+h+",Width="+w+",resizable=no,scrollbars=yes,status=no,location=no,menubar=no,toolbar=no,directories=no,top="+Y+",left="+X ;
		    mywin = window.open(url,"a",dm);    	
		}
		function addTheme(){
			openWindow('/QueryTools/theme/addTheme','700','700');
		}
		/**
		删除tr
		*/
		var ThemeControl = {
			del:function(o){
				$(o).parent().parent().remove();
			},
			updateFiles:function(id){
				openWindow('/QueryTools/theme/themeInfo?id='+id,'700','700');
			},
			delFiles:function (os,id){
				if(confirm("确认要删除附件？")){
					$.ajax({
						url: "/QueryTools/theme/deleteTheme",//提交的action
						type: "POST",
						async:false,
						data : {id:id},//		  
						error: function(request) { // 设置表单提交出错
				      		alert("未知错误！");
				      	},
				      	success: function(data) {// 设置提交完成使用方法
				      		var result = $.trim(data);
				      		if(result=="true" || result==true){
				      			alert("删除成功！");
				      			window.location.reload();
				      		}else{
				      			alert("删除失败！");
				      		}
				      	}
					});
				}
			}
		};	
    </script>
  </head>
  <body>
    <c:import url="/front/front_head.jsp"></c:import>
    <div class="container">

        <h1 align="center" class="form-signin-heading">主题管理</h1>
        <div class="bs-example">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>编号</th>
						<th>主题名称</th>
						<th>主题创建人</th>
						<th>创建时间</th>
						<th>备注</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach var="theme" items="${themes }" varStatus="status">
						<tr>
							<td>${status.index+1 }</td>
							<td>${theme.name }</td>
							<td>${theme.author }</td>
							<td>${theme.inputTime }</td>
							<td>${theme.des }</td>
							<td>
								<a href="javascript:ThemeControl.delFiles(this,'${theme.id}');" >删除</a>
								<a href="javascript:ThemeControl.updateFiles('${theme.id}');" >修改</a>
							</td>
						</tr>
					</c:forEach>
					<tr>
					<tr>
				</tbody>
			</table>
		</div>
		<div align="center">
			<a href="javascript:void(0);" onclick="addTheme()" class="btn btn-lg btn-primary" role="button">添加主题</a>&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="/QueryTools/index.jsp" class="btn btn-lg btn-primary" role="button">返回</a>
		</div>
    </div> <!-- /container -->
    <script src="/QueryTools/js/jquery-1.10.2.js"></script>
    <script src="/QueryTools/bootstrap/js/bootstrap.js"></script>
  </body>
</html>
